package io.lkt.modules.sys.service.impl;

import io.lkt.commons.dynamic.datasource.annotation.DataSource;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.lkt.common.utils.PageUtils;
import io.lkt.common.utils.Query;

import io.lkt.modules.sys.dao.BBusinessInfoDao;
import io.lkt.modules.sys.entity.BBusinessInfoEntity;
import io.lkt.modules.sys.service.BBusinessInfoService;


@Service("bBusinessInfoService")
public class BBusinessInfoServiceImpl extends ServiceImpl<BBusinessInfoDao, BBusinessInfoEntity> implements BBusinessInfoService {
    @Override
    @DataSource("master")
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<BBusinessInfoEntity> page = this.page(
                new Query<BBusinessInfoEntity>().getPage(params),
                new QueryWrapper<BBusinessInfoEntity>()
        );

        return new PageUtils(page);
    }

    @DataSource("master")
    public BBusinessInfoEntity getById(Serializable id)
    {
        return (BBusinessInfoEntity)((BBusinessInfoDao)this.baseMapper).selectById(id);
    }

    @DataSource("master")
    public boolean save(BBusinessInfoEntity entity)
    {
        return retBool(Integer.valueOf(((BBusinessInfoDao)this.baseMapper).insert(entity)));
    }

    @DataSource("master")
    public boolean updateById(BBusinessInfoEntity entity)
    {
        return retBool(Integer.valueOf(((BBusinessInfoDao)this.baseMapper).updateById(entity)));
    }

}
